package com.flow.dao.impl;

import java.util.ArrayList;
import java.util.List;

import com.flow.dao.IBankMessageDao;
import com.flow.model.BankMessage;
import com.flow.model.PagerModel;

/**
 * 
 * 银行信息Dao
 * 
 * @author wang
 * @2016-2-16 BankMessageDao.java
 * @param <T>
 */
public class BankMessageDao<T> extends BaseDao<T> implements IBankMessageDao<T> {

	@Override
	public boolean insertBankMessage(BankMessage bankMessage) {

		try {

			this.insert(bankMessage);
			return true;

		} catch (Exception e) {

			e.printStackTrace();

		}
		return false;
	}

	@Override
	public boolean updateBankMessage(BankMessage bankMessage) {
		
		try {

			this.update(bankMessage);
			return true;

		} catch (Exception e) {

			e.printStackTrace();

		}
		return false;
	}

	@Override
	public boolean deleteBankMessage(BankMessage bankMessage) {

		try {

			this.delete(bankMessage);
			return true;

		} catch (Exception e) {

			e.printStackTrace();

		}
		return false;
		
	}

	@Override
	public BankMessage findBankMessageByHql(String hql) {

		return findBankMessageByHql(hql, null);
		
	}

	@Override
	public BankMessage findBankMessageByHql(String hql, Object param) {
		
		List<Object> params = new ArrayList<Object>();
		params.add(param);
		return findBankMessageByHql(hql, params);
	}

	@Override
	public BankMessage findBankMessageByHql(String hql, List<Object> params) {

		return (BankMessage)this.findByHql(hql, params);
		
	}

	@Override
	public int universalMethodBankMessage(String hql) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int universalMethodBankMessage(String hql, Object param) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int universalMethodBankMessage(String hql, List<Object> params) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public List<T> findBankMessageAllByHql(String hql) {

		return this.findBankMessageAllByHql(hql, null);

	}

	@Override
	public List<T> findBankMessageAllByHql(String hql, Object param) {

		List<Object> params = new ArrayList<Object>();
		params.add(param);
		return this.findBankMessageAllByHql(hql, params);

	}

	@Override
	public List<T> findBankMessageAllByHql(String hql, List<Object> params) {

		return this.findAllByHql(hql, params);

	}

	@Override
	public PagerModel findBankMessagePagerModeled(PagerModel pager, String hql) {

		return this.findBankMessagePagerModeled(pager, hql, null);

	}

	@Override
	public PagerModel findBankMessagePagerModeled(PagerModel pager, String hql,
			Object param) {

		List<Object> params = new ArrayList<Object>();
		params.add(param);
		return this.findBankMessagePagerModeled(pager, hql, params);
	}

	@Override
	public PagerModel findBankMessagePagerModeled(PagerModel pager, String hql,
			List<Object> params) {

		return this.findPagerModeled(pager, hql, params);

	}

}
